<?php
!defined('P_W') && exit('Forbidden');

!$_G['allowhonor'] && Showmsg('undefined_action');

if (empty($_POST['step'])) {

	require_once PrintEot('ajax');
	ajax_footer();

} else {

	PostCheck();
	InitGP(array(
		'content'
	), 'P');
	$content = trim(str_replace("\n", '', $content));
	strlen($content) > 90 && $content = substrs($content, 90);

	$wordsfb = L::loadClass('FilterUtil', 'filter');
	$banword = $wordsfb->comprise(stripslashes($content));
	if ($banword !== false) {
		Showmsg('content_wordsfb');
	}
	if ($winddb['honor'] != stripslashes($content)) {
		$userService = L::loadClass('UserService', 'user'); /* @var $userService PW_UserService */
		$userService->update($winduid, array('honor'=>$content));
		
		$_cache = getDatastore();
		$_cache->delete('UID_'.$winduid);

		/*
		if ($db_modes['o']['ifopen'] && '' != $content) {
			$db->update("INSERT INTO pw_owritedata SET" . pwSQLSingle(array(
				'uid' => $winduid,
				'touid' => 0,
				'postdate' => $timestamp,
				'isshare' => 0,
				'source' => 'signature',
				'content' => $content
			)));
		}
		*/
	}
	//require_once (R_P . 'require/postfunc.php');
	echo "success\t" . stripslashes($content);
	ajax_footer();
}
